﻿using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using BLL.Action.Job;
using System.Threading;
using Common.Logging;
using Quartz;
using System.Collections.Specialized;
using CenterDateAchieve.Test.Init;
using AppToolKit.Core.Context.Spring;
 
namespace CenterDateAchieve.Test
{
    [TestFixture]
    public class TestJob
    {
        private ServerContextFixure fixure_;
        private ContextAware ContextAwareSlot;
        [TestFixtureSetUp]
        public void FixureSetup()
        {
            fixure_ = new ServerContextFixure();
            //MaintBusiness_ = (IMaintBusiness)fixure_.LoadObject(typeof(IMaintBusiness));
            NameValueCollection properties = new NameValueCollection();
            properties["showDateTime"] = "true";
            ContextAwareSlot = (ContextAware)fixure_.LoadObject(typeof(ContextAware));
            // set Adapter
            Common.Logging.LogManager.Adapter = new Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter(properties);
            //MaintBusiness_ = new MaintBusiness();
            //ContextAwareSlot.AutowireObject(MaintBusiness_);

        }
        [TestFixtureTearDown]
        public void TearDown()
        {
            fixure_.Dispose();
        }
        [Test]
        public void jobTest()
        {

            ILog log = LogManager.GetLogger(typeof(TestJob));

            log.Debug("stop");
            JobManager job = new JobManager();
            ContextAwareSlot.AutowireObject(job);
            job.Run(); 
          
            Thread.Sleep(20* 1000);

            job.OnStop();
        }
        [Test]
        public void sttop()
        {
            JobManager job = new JobManager();
            job.OnStop();
        }
    }
}
